---@class Battle.GlobalBuffSystem
local GlobalBuffSystem = Battle.CreateClass("GlobalBuffSystem")
Battle.GlobalBuffSystem = GlobalBuffSystem
local this = GlobalBuffSystem

function GlobalBuffSystem.OnCreate()
    this.accelerateBuffId = 0
    this.weatherBuffId = 0
    Battle.GlobalEventSystem.Register(Battle.Event.ActorCreate,this.ActorCreate)
end
function GlobalBuffSystem.OnDestroy()
    this.accelerateBuffId = 0
end
function GlobalBuffSystem.AddAccelerateBuff(id)
    this.accelerateBuffId = id
    for k,v in pairs(Battle.ActorManager.GetActorList()) do
        v:AddBuff(id)
    end
end
function GlobalBuffSystem.AddWeatherBuff(idList)
    this.weatherBuffId = idList[1]
    for k,v in pairs(Battle.ActorManager.GetActorList()) do
        v:AddBuff(this.weatherBuffId)
    end
end
---@param args BattleEvent
function GlobalBuffSystem.ActorCreate(args)
    if this.accelerateBuffId > 0 then
        args.sender:AddBuff(this.accelerateBuffId)
    end
    if this.weatherBuffId > 0 then
        args.sender:AddBuff(this.weatherBuffId)
    end
end